package com.zuipin.service;

import java.math.BigDecimal;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

import com.zuipin.entity.MemberLevel;
import com.zuipin.entity.shoppingCart.CartParam;
import com.zuipin.entity.shoppingCart.CartProInfo;
import com.zuipin.entity.shoppingCart.ProRuleSet;
import com.zuipin.entity.shoppingCart.ShoppingCart;
import com.zuipin.framework.exception.CustomException;
import com.zuipin.framework.result.Result;
import com.zuipin.vo.BackOrderDetailVo;
import com.zuipin.vo.FrontOrderVo;
import com.zuipin.vo.OrderBuyAgainVo;
import com.zuipin.vo.RedPacketVo;

public interface IShoppingCartService {
	
	public Map<String, Object> addBuyNum(CartParam cartParam) throws CustomException;
	
	public Map<String, Object> updateBuyNum(CartParam cartParam) throws CustomException;
	
	public Map<String, Object> del(String ids);
	
	public Map<String, Object> query(CartParam cartParam) throws CustomException, ParseException;
	
	public Map<String, Object> settle(CartParam cartParam, List<ShoppingCart> shoppingCartList) throws CustomException, ParseException;
	
	public Map<String, Object> settleView(CartParam cartParam, List<ShoppingCart> shoppingCartList) throws CustomException, ParseException;
	
	public Map<String, Object> submitOrder(CartParam cartParam, List<ShoppingCart> shoppingCartList) throws CustomException, ParseException;
	
	public Map<String, Map<String, Object>> findCisBranchStockByProSkus(String proSkus) throws CustomException;
	
	public String jugeCanBuy(Long memberId, Long sysId) throws CustomException;
	
	/** 
	 * 结算查询	
	 *
	 * @Title: queryBySettle 
	 * @author: wuyicheng
	 * @date: 2017年6月14日上午9:21:28 
	 * @param ids
	 * @param buyerId
	 * @param sysId
	 * @return
	 * @return: List<ShoppingCart>
	 * @throws 
	 */
	List<ShoppingCart> queryBySettle(String[] ids, Long buyerId, Long sysId);
	
	/** 
	 *
	 * @Title: createVirtualShoppingCart 
	 * @author: wuyicheng
	 * @date: 2017年6月14日上午11:00:19 
	 * @param orderDetails
	 * @return
	 * @return: List<ShoppingCart>
	 * @throws 
	 */
	public List<ShoppingCart> createVirtualShoppingCart(List<BackOrderDetailVo> orderDetails, Long memberId, Long sysId);
	
	/** 
	 * 获取可用红包
	 * @Title: getCartRedPacket 
	 * @author: wuyicheng
	 * @date: 2017年6月14日下午2:05:32 
	 * @param cartList
	 * @param cartParam
	 * @return
	 * @throws CustomException
	 * @return: List<RedPacketVo>
	 * @throws 
	 */
	List<RedPacketVo> getCartRedPacket(List<ShoppingCart> cartList, CartParam cartParam) throws CustomException;
	
	/**
	 * 
	 * 购物车规则计算
	 * 
	 * @Title: calculateShoppingCart 
	 * @author: wuyicheng
	 * @date: 2017年6月15日下午6:34:03 
	 * @param cartParam
	 * @param map
	 * @param shoppingCartList
	 * @return
	 * @throws CustomException
	 * @return: Map<String,Object>
	 * @throws 
	 */
	Map<String, Object> calculateShoppingCart(CartParam cartParam, Map<String, Object> map, List<ShoppingCart> shoppingCartList) throws CustomException;
	
	/**
	 * 获取商品信息
	 *
	 * @Title: getProInfo 
	 * @author: wuyicheng
	 * @date: 2017年7月13日下午2:58:45 
	 * @param proId 商品ID
	 * @param proSku 商品SKU
	 * @param sysId 系统ID
	 * @param memberId 会员ID
	 * @param device 平台PC|WAP
	 * @param buyNum 购买数量
	 * @return
	 * @throws CustomException
	 * @return: CartProInfo
	 * @throws
	 */
	CartProInfo getProInfo(Long proId, String proSku, Long sysId, Long memberId, String device, BigDecimal buyNum, boolean isPremium) throws CustomException;
	
	/**
	 * 
	 * 购物车商品详情
	 * 
	 * @Title: shoppingCartDetail 
	 * @author: wuyicheng
	 * @date: 2017年7月4日上午9:13:57 
	 * @param cartParam
	 * @param shoppingCartList
	 * @param memberLevel
	 * @throws CustomException
	 * @throws ParseException  
	 * @return: void
	 * @throws 
	 */
	void shoppingCartDetail(CartParam cartParam, List<ShoppingCart> shoppingCartList, MemberLevel memberLevel) throws CustomException;
	
	/** 
	 * 查询可用特价规则商品
	 * 
	 * @Title: canUseSpecialPricePro 
	 * @author: wuyicheng
	 * @date: 2017年7月13日下午4:38:29 
	 * @param memberId
	 * @param sysId
	 * @param device
	 * @param proSku
	 * @return
	 * @throws CustomException
	 * @return: ProRuleSet
	 * @throws 
	 */
	ProRuleSet canUseSpecialPricePro(Long memberId, Long sysId, String device, String proSku, BigDecimal buyNums) throws CustomException;
	
	/**
	 * 再次购买功能  前台订单数据
	 * @param frontOrderVo
	 * @param 是否立即购买
	 * @return 不能购买的列表信息
	 * @throws CustomException 
	 */
	Result<OrderBuyAgainVo> buyAgain(FrontOrderVo frontOrderVo, Boolean flag) throws CustomException;
	
	/**
	 * 新增赠品
	 * @param skus
	 * @param sysId
	 * @param memberId
	 * @param buyNum
	 */
	public void addPremium(List<String> skus, Long sysId, Long memberId, BigDecimal buyNum, Long ruleId, String ruleName);
	
	public void shoppingCartRuleSet(CartParam cartParam, List<ShoppingCart> shoppingCartList, Map<String, Object> map) throws CustomException;
	
	/** 
	 * 根据运费模板计算宇飞
	 * @Title: getFreight 
	 * @author: wuyicheng
	 * @date: 2017年8月17日下午5:38:26 
	 * @param cartParam
	 * @param delivery
	 * @param payMethod
	 * @param totalWeight
	 * @return
	 * @return: BigDecimal
	 * @throws 
	 */
	BigDecimal getFreight(CartParam cartParam, String delivery, String payMethod, BigDecimal totalWeight);
	
	/** 
	 *
	 * @Title: checkStock 
	 * @author: wuyicheng
	 * @date: 2017年8月19日上午11:38:29 
	 * @param proSku
	 * @param bigDecimal
	 * @param returnMap
	 * @return
	 * @return: boolean
	 * @throws 
	 */
	public boolean checkStock(String proSku, BigDecimal bigDecimal, Map<String, Map<String, Object>> returnMap);
}
